package com.software.seakdream.service;

import com.software.seakdream.entity.AssessResult;
import com.software.seakdream.repository.AssessResultRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class AssessResultServiceImpl implements AssessResultService{

    @Autowired
    AssessResultRepository assessResultRepository;

    @Override
    public AssessResult getAssessResult(String amount) {
        System.out.println(amount);
        int point = Integer.parseInt(amount.split("=")[1]);
        int id = point/20;
        System.out.println(id);
        AssessResult assessResult = new AssessResult();

        switch (id){
            case 1:
                assessResult = assessResultRepository.findAssessResultById(1);
                break;
            case 2:
                assessResult = assessResultRepository.findAssessResultById(2);
                break;
            case 3:
                assessResult = assessResultRepository.findAssessResultById(3);
                break;
            case 4:
                assessResult = assessResultRepository.findAssessResultById(4);
                break;
            case 5:
                assessResult = assessResultRepository.findAssessResultById(4);
                break;
        }

        return assessResult;
    }
}
